<?php
	$start = '<span class="coloRed">*</span>';
	$error = isset($_GET['error'])?$_GET['error']:'';
?>
<script>
	function f()
	{
		var x=document.forms["seller_register"]["fname"].value
		if (x==null || x=="")
		 {
		 	document.getElementById("a").innerHTML = "Please in put first name!";
		 }else{
			 document.getElementById("a").innerHTML = "";
		 }
	}
	function l()
	{
		var x=document.forms["seller_register"]["lname"].value
		if (x==null || x=="")
		 {
		 	document.getElementById("a1").innerHTML = "Please in put last name!";
		 }else{
			 document.getElementById("a1").innerHTML = "";
		 }
	}	
	function p()
	{
		var x=document.forms["seller_register"]["pass"].value
		if (x==null || x=="")
		{
		 	document.getElementById("a2").innerHTML = "Password must be filled out";
		}else{
			 document.getElementById("a2").innerHTML = "";
		}
	}	
	function c()
	{
		var x=document.forms["seller_register"]["cpass"].value
		var pass=document.forms["seller_register"]["pass"].value
		
		if (x==null || x=="")
		{
		  document.getElementById("a3").innerHTML = "confirm password must be filled out";
		}
		else if(x!=pass){
			document.getElementById("a3").innerHTML = "Confirm password not the same password!";
		}
		else{
			 document.getElementById("a3").innerHTML = "";
		}		
	}
	function secword()
	{
		var x=document.forms["seller_register"]["sec_word"].value
		if (x==null || x=="")
		  {
		  	 document.getElementById("a4").innerHTML = "Security word must be filled out";
		  }
		else{
			 document.getElementById("a4").innerHTML = "";
		}
	}
	function ue()
	{
		var x=document.forms["seller_register"]["uemail"].value
		var atpos=x.indexOf("@");
		var dotpos=x.lastIndexOf(".");
				
		if (x==null || x=="")
	  	{
			 document.getElementById("a5").innerHTML = "Email must be filled out";
	  	}		
		else if (atpos<1 || dotpos<atpos+2 || dotpos+2>=x.length)
	  	{
	   		document.getElementById("a5").innerHTML = "Not a valid e-mail address";
	  	}
		else{
			 document.getElementById("a5").innerHTML = "";
		}
	}
	function ce()
	{
		var x=document.forms["seller_register"]["cemail"].value
		var ex=document.forms["seller_register"]["uemail"].value
		if (x==null || x=="")
		  {
		  	 document.getElementById("a6").innerHTML = "Confirm email must be filled out";
		  }
		else if(x!=ex){
			document.getElementById("a6").innerHTML = "Confirm email not macth";
		}
		else{
			 document.getElementById("a6").innerHTML = "";
		}
	}
	function cpo()
	{
		var x=document.forms["seller_register"]["cphone"].value
		if (x==null || x=="")
		  {
		  	 document.getElementById("a7").innerHTML = "Phone must be filled out";
		  }
		else{
			 document.getElementById("a7").innerHTML = "";
		}
	}
	function caddr()
	{
		var x=document.forms["seller_register"]["caddress"].value
		if (x==null || x=="")
		  {
		  	 document.getElementById("a8").innerHTML = "Address must be filled out";
		  }
		else{
			 document.getElementById("a8").innerHTML = "";
		}
	}
	
	function phaname() {
		var x=document.forms["seller_register"]["pharmacy_name"].value
		if (x==null || x=="")
		  {
		  	 document.getElementById("b").innerHTML = "Pharmacy Name must be filled out";
		  }
		else{
			 document.getElementById("b").innerHTML = "";
		}
	}
	function im(){
		var x=document.forms["seller_register"]["image"].value
		if (x==null || x=="")
		  {
		  	 document.getElementById("b1").innerHTML = "Image Logo must be filled out";
		  }
		else{
			 document.getElementById("b1").innerHTML = "";
		}
	}
	function phaaddr(){
		var x=document.forms["seller_register"]["pharmacy_address"].value
		if (x==null || x=="")
		  {
		  	 document.getElementById("b2").innerHTML = "Address of pharmacy must be filled out";
		  }
		else{
			 document.getElementById("b2").innerHTML = "";
		}
	}
	function phaphone(){
		var x=document.forms["seller_register"]["pharmacy_phone"].value
		if (x==null || x=="")
		  {
		  	 document.getElementById("b3").innerHTML = "Phone of pharmacy must be filled out";
		  }
		else{
			 document.getElementById("b3").innerHTML = "";
		}
	}
	function phaemail(){
				
		var x=document.forms["seller_register"]["pharmacy_email"].value
		var atpos=x.indexOf("@");
		var dotpos=x.lastIndexOf(".");
				
		if (x==null || x=="")
	  	{
			 document.getElementById("b4").innerHTML = "Email of pharmacy must be filled out";
	  	}		
		else if (atpos<1 || dotpos<atpos+2 || dotpos+2>=x.length)
	  	{
	   		document.getElementById("b4").innerHTML = "Not a valid e-mail address";
	  	}
		else{
			 document.getElementById("b4").innerHTML = "";
		}
	}
	function phalic(){
		var x=document.forms["seller_register"]["pharmacy_license"].value
		if (x==null || x=="")
		  {
		  	 document.getElementById("b5").innerHTML = "License of pharmacy must be filled out";
		  }
		else{
			 document.getElementById("b5").innerHTML = "";
		}
	}
	function secritcode(){
		var x=document.forms["seller_register"]["secrit"].value
		if (x==null || x=="")
		  {
		  	 document.getElementById("b6").innerHTML = "Security code must be filled out";
		  }
		else{
			 document.getElementById("b6").innerHTML = "";
		}
	}
</script>	
<div id="eidtProductPrice">
    	<?php
    	if($error!=""){
		?>
		<div class="message"><strong><?php echo $error;?></strong></div>
		<?php } ?>
    	<form name="seller_register" id="seller_register" method="post" enctype="multipart/form-data" action="<?php echo W_ROOT; ?>/process_register.php?action=register_s">
        	<table cellpadding="5" cellspacing="5" align="center" width="100%">
            	<!--<tr height="10"><td></td></tr>-->
                <tr>
                	<td colspan="2">
                    	<div style="float:left; width:300px;"><span style="color:#417EFB; font-size:18px;"><!--Personal Information--><?php echo $lang['PERSONALINFORR'];?></span></div>
                    	<div style="float:right;"><span class="coloRed"><!--Note : All (*) are required--><?php echo $lang['NOTESTAR'];?></span></div>
                    </td>
                </tr>
            	<!--<tr>
                	<td width="400"><span style="color:#417EFB; font-size:18px;">Personal Information</span></td>
                    <td></td>
                    <td><span class="coloRed">Note : All (*) are required</span></td>
                </tr>-->
			
            	<tr>
                	<tr>
                        <td><label for="title"><!--Title--><?php echo $lang['SHIP_TITLE'];?></label></td>
                        <td>: <select id="title1" name="title1">
                                <option selected="selected"><!--Please select one--><?php echo $lang['PLSSELECTONE'];?></option>
                                <option <?php
								if(isset($_SESSION['title1']))
								{
									echo("Mr."==$_SESSION['title1'])?' selected="selected"':'';
								}
								?>><!--Mr.--><?php echo $lang['MRR'];?></option>
                                <option <?php
								if(isset($_SESSION['title1']))
								{
									echo("Mrs."==$_SESSION['title1'])?' selected="selected"':'';
								}
								?>><!--Mrs.--><?php echo $lang['MRS'];?></option>
                                <option <?php
								if(isset($_SESSION['title1']))
								{
									echo("Miss."==$_SESSION['title1'])?' selected="selected"':'';
								}
								?>><!--Miss.--><?php echo $lang['MISSSa'];?></option>
                            </select>
                        </td>
                    </tr>
                </tr>
                <tr>
                	<td><!--First Name--><?php echo $lang['SHIP_FIR_NAME'];?><?php echo $start;?></td>
                    <td>: <input type="text" name="fname" id="fname" value="<?php echo (isset($_SESSION['fname']))?$_SESSION['fname']:'';?>" onblur="f();"/></td>
                </tr>
                <tr><td colspan="2" id="a" style="color:#F00; font-style:italic;"></td></tr>
                <tr>
                	<td><!--Last Name--><?php echo $lang['SHIP_LAS_NAME'];?><?php echo $start;?></td>
                    <td>: <input type="text" name="lname" id="lname" value="<?php echo (isset($_SESSION['lname']))?$_SESSION['lname']:'';?>" onblur="l();"/></td>
                </tr>
                <tr><td colspan="2" id="a1" style="color:#F00; font-style:italic;"></td></tr>
                <tr>
                	<td><!--Password--><?php echo $lang['LOG_PASSWORD'];?><?php echo $start;?></td>
                    <td>: <input type="password" name="pass" value="<?php echo (isset($_SESSION['title1']))?$_SESSION['title1']:'';?>" id="pass" onblur="p();"/></td>
                </tr>
                <tr><td colspan="2" id="a2" style="color:#F00; font-style:italic;"></td></tr>
                <tr>
                	<td><!--Confirm Password--><?php echo $lang['CONFIRMPASSWORDS'];?><?php echo $start;?></td>
                    <td>: <input type="password" value="<?php echo (isset($_SESSION['cpass']))?$_SESSION['cpass']:'';?>" name="cpass" id="cpass" onblur="c();"/></td>
                </tr>
                <tr><td colspan="2" id="a3" style="color:#F00; font-style:italic;"></td></tr>
                <tr>
                    <td><!--Security word--><?php echo $lang['SECURITYWORD'];?> <?php echo $start;?></td>
                    <td>: <input type="text" value="<?php echo (isset($_SESSION['sec_word']))?$_SESSION['sec_word']:'';?>" name="sec_word" id="sec_word" onblur="secword();" /></td>            
                </tr>
                <tr><td colspan="2" id="a4" style="color:#F00; font-style:italic;"></td></tr>
                <tr>
                	<td><!--Email--><?php echo $lang['SHIP_EMAIL'];?><?php echo $start;?></td>
                    <td>: <input type="text" value="<?php echo (isset($_SESSION['uemail']))?$_SESSION['uemail']:'';?>" name="uemail" id="uemail" onblur="ue();" /></td>
                </tr>
                <tr><td colspan="2" id="a5" style="color:#F00; font-style:italic;"></td></tr>
                <tr>
                	<td><!--Confirm Email--><?php echo $lang['CONFIRMEMAILL'];?><?php echo $start;?></td>
                    <td>: <input type="text" value="<?php echo (isset($_SESSION['cemail']))?$_SESSION['cemail']:'';?>" name="cemail" id="cemail" onblur="ce();" /></td>
                </tr>
                <tr><td colspan="2" id="a6" style="color:#F00; font-style:italic;"></td></tr>
                <tr>
                	<td><!--telephone--><?php echo $lang['SHIP_PHONE'] ;?></td>
                    <td>: <input type="text" name="cmobile" id="cmobile" value="<?php echo (isset($_SESSION['cmobile']))?$_SESSION['cmobile']:'';?>" /></td>
                </tr>
                <tr>
                	<td><!--mobilephone--><?php echo $lang['SHIP_MPHONE'];?><?php echo $start;?></td>
                    <td>: <input type="text" name="cphone" id="cphone" value="<?php echo (isset($_SESSION['cphone']))?$_SESSION['cphone']:'';?>" onblur="cpo();" /></td>
                </tr>
                <tr><td colspan="2" id="a7" style="color:#F00; font-style:italic;"></td></tr>
                <tr>
                	<td><!--Address--><?php echo $lang['ADDRSELLER'];?><?php echo $start;?></td>
                    <td>: <input type="text" name="caddress" id="caddress" value="<?php echo (isset($_SESSION['caddress']))?$_SESSION['caddress']:'';?>" onblur="caddr();" /></td>
                </tr>
                <tr><td colspan="2" id="a8" style="color:#F00; font-style:italic;"></td></tr>
                <tr>
                	<td><!--Country--><?php echo $lang['SHIP_COUNTRY'];?></td>                   
                    <td>: <select id="ccountry" name="ccountry">
                    		<option selected="selected"><!--Select Contry--><?php echo $lang['SEL_COUNTRY'] ;?></option>
                        	<?php
								$query="SELECT * FROM tblcountries ORDER BY country_name";
								$result = mysql_query($query);
								while($row = mysql_fetch_assoc($result)){
								if(isset($_SESSION['ccountry']))
								{
									$selectCon = ($row['id']==$_SESSION['ccountry'])?' selected="selected"':'';
								}
								else
								{
									$selectCon = '';
								}
							?>
						
						<option value="<?php echo $row['id'];?>" <?php echo $selectCon;?>>
						<?php echo $row['country_name'] ; ?></option>
                            <?php
							}
							?>
                      	</select>
                    </td>
                </tr>
                 <tr>
                	<td colspan="2">
                    	<div style="width:300px;"><span style="color:#417EFB; font-size:18px;"><!--Company Information--><?php echo $lang['COMPANYINFO'];?></span></div>
                    </td>
                </tr>
                <tr>
                	<td><!--Company Name--><?php echo $lang['COMPANYNAMEE'];?><?php echo $start;?></td>
                    <td>: <input type="text" name="pharmacy_name" id="pharmacy_name" value="<?php echo (isset($_SESSION['pharmacy_name']))?$_SESSION['pharmacy_name']:'';?>" onblur="phaname();" /></td>
                </tr>
                <tr><td colspan="2" id="b" style="color:#F00; font-style:italic;"></td></tr>
                <tr>
                	<td><!--Logo--><?php echo $lang['LOGO'];?><?php echo $start;?></td>
                    <td>: 
                    	<!--<form action="#" method="post" enctype="multipart/form-data">
							<input type="file" name="image" id="file" />
							
						</form>-->
                        <input type="file" name="file_image" id="file_image" onblur="im();" />
                        <?php
						if(isset($_FILES["file_image"])){
						?>	
                        <?php echo $_FILES["file_image"];?>
						<?php	
						}						
						?>
                     </td>
                </tr>
                <tr><td colspan="2" id="b1" style="color:#F00; font-style:italic;"></td></tr>
                <tr>
                	<td><!--Company Adress--><?php echo $lang['COMPANYADDD'];?><?php echo $start;?></td>
                    <td>: <input type="text" name="pharmacy_address" id="pharmacy_address" value="<?php echo (isset($_SESSION['pharmacy_address']))?$_SESSION['pharmacy_address']:'';?>" onblur="phaaddr();" /></td>
                </tr>
                <tr><td colspan="2" id="b2" style="color:#F00; font-style:italic;"></td></tr>
                <tr>
                	<td colspan="2"></td>
                </tr>
                <tr>
                   		<td><!--Location--><?php echo $lang['LOCATION'];?></td>
                        <td>: 
						<select id="location" name="location">
                        	<?php
								$query="SELECT * FROM tblprovince ORDER BY province_id";
								$result=mysql_query($query);
								while($row=mysql_fetch_assoc($result)){
								if(isset($_SESSION['location']))
								{
									$selectLo = ($row['province_id']==$_SESSION['location'])?' selected="selected"':'';
								}
								else
								{
									$selectLo = '';
								}
							?>
                            <option value="<?php echo $row['province_id']; ?>" <?php echo $selectLo;?>>
                            	<?php echo $row['province_name']; ?>
                            </option>
                            <?php } ?>
                        </select>
                        </td>
                </tr>
                 <tr>
                	<td><!--Hand Phone--><?php echo $lang['SHIP_MPHONE'];?><?php echo $start;?></td>
                    <td>: <input type="text" name="pharmacy_phone" id="pharmacy_phone" onblur="phaphone();" value="<?php echo (isset($_SESSION['pharmacy_phone']))?$_SESSION['pharmacy_phone']:'';?>" /></td>
                </tr>
                <tr><td colspan="2" id="b3" style="color:#F00; font-style:italic;"></td></tr>
                 <tr>
                	<td><!--Fax--><?php echo $lang['FAX'];?></td>
                    <td>: <input type="text" name="pharmacy_fax"  value="<?php echo (isset($_SESSION['pharmacy_fax']))?$_SESSION['pharmacy_fax']:'';?>"/></td>
                </tr>
                 <tr>
                	<td><!--Email--><?php echo $lang['SHIP_EMAIL'];?><?php echo $start;?></td>
                    <td>: <input type="text" name="pharmacy_email" id="pharmacy_email" value="<?php echo (isset($_SESSION['pharmacy_email']))?$_SESSION['pharmacy_email']:'';?>" onblur="phaemail();" /></td>
                </tr>
                <tr><td colspan="2" id="b4" style="color:#F00; font-style:italic;"></td></tr>
                 <tr>
                	<td><!--Website--><?php echo $lang['WEBSITE'];?></td>
                    <td>: <input type="text" name="pharmacy_website" value="<?php echo (isset($_SESSION['pharmacy_website']))?$_SESSION['pharmacy_website']:'';?>"/></td>
                </tr>
                <tr>
                	<td><!--Open hour--><?php echo $lang['OPENHOUR'];?></td>
                    <td>: <select name="open_hour" id="open_hour">
					
					
						<?php 
						if(isset($_SESSION['open_hour'])){
							$open=(($row['open_hour'])==$_SESSION['open_hour'])?' selected="selected"':'';
							
						}
						else{
							$open="";
						}
					?>
					
							<?php for($i = 0;$i<24 ;$i++){
									if(strlen($i) > 1){ ?>
										<option value="<?php echo $i; ?>" <?php echo $open;?>><?php echo $i.": 00"; ?></option>
										
                                    <?php
									}else{
											if($i==8){
									?>
												<option value="<?php echo "0".$i; ?>" selected="selected"><?php echo "0".$i.": 00"; ?></option>        
									<?php
											}else{?>
												<option value="<?php echo "0".$i; ?>" <?php echo $open;?>><?php echo "0".$i.": 00"; ?></option>
									  <?php }
										}
								} ?>
                    	</select></td>
                </tr>
                <tr>
                	<td><!--Close hour--><?php echo$lang['CLOSEHOUR']; ?></td>
					
                    <td>: <select name="close_hour" id="close_hour">
					
					
						<?php 
							if(isset($_SESSION['close_hour'])){
								$close=(($row['close_hour'])==$_SESSION['close_hour'])?' selected="selected"':'';
							}
							else{
								$close="";
							}
						?>
					
							<?php for($i = 0;$i<24 ;$i++){
									if(strlen($i) > 1){ ?>
										<option value="<?php echo $i; ?>" <?php echo $close;?>><?php echo $i.": 00"; ?></option>
										
                                    <?php
									}else{
											if($i==8){
									?>
												<option value="<?php echo "0".$i; ?>" selected="selected"><?php echo "0".$i.": 00"; ?></option>        
									<?php
											}else{?>
												<option value="<?php echo "0".$i; ?>" <?php echo $close;?>><?php echo "0".$i.": 00"; ?></option>
									  <?php }
										}
								} ?>
                    	</select></td>
                </tr>
                <tr>
                	<td><!--License--><?php echo $lang['LICENSES'];?><?php echo $start;?></td>
                    <td>: <input type="text" name="pharmacy_license" id="pharmacy_license" value="<?php echo (isset($_SESSION['pharmacy_license']))?$_SESSION['pharmacy_license']:'';?>" onblur="phalic();" /></td>
                </tr>
                <tr><td colspan="2" id="b5" style="color:#F00; font-style:italic;"></td></tr>
                <tr>
                	<td></td>
                    <td>&nbsp;<input type="checkbox" name="newsletter" value="1" <?php                           
                                echo(isset($_SESSION['newsletter']))?' checked="checked"':'';                            
                             ?> /><!--Receive newsletter--><?php echo $lang['RCIEVENEW'];?>
                    </td>
                </tr>
                <tr>
                    <td></td>
                    <td><img src="<?php echo W_ROOT;?>/captchar/CaptchaSecurityImages.php?width=100&height=40&characters=5" /></td>
                </tr>
                <tr>
                    <td></td>
                    <td><input id="secrit" name="secrit" onblur="secritcode();" /></td>
                </tr>
                <tr><td colspan="2" id="b6" style="color:#F00; font-style:italic;"></td></tr>
                <tr>
                	<td></td>
                    <td>&nbsp; <input type="submit" name="register" value="<?php echo $lang['REGISTERR'];?>" onclick="tit();" />
                    	<input type="reset" value="<?php echo $lang['RESET'];?>" />
                    </td>
                </tr>
            </table>
        </form>
</div>